﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Forms;
using System.Drawing;

namespace ManagmentWMS
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        Control control;
        NotifyIcon ni = new NotifyIcon();

        public MainWindow()
        {
            InitializeComponent();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            control = new Control(this);
            control.Loaded();

            /*
            ni.Text = "Managment WMS";
            ni.Icon = new Icon("appicon.ico");
            ni.Visible = true;
            ni.Tag = "www.tatuum.com";           
            ni.BalloonTipText = "Kan Sp. z o.o.";
            ni.BalloonTipTitle = "Managment WMS";
            ni.BalloonTipIcon = ToolTipIcon.Warning;
            ni.DoubleClick +=new EventHandler(ni_DoubleClick);
            ni.Click +=new EventHandler(ni_Click);
            ni.ShowBalloonTip(1000);           
            */
        }

        private void ni_DoubleClick(object Sender, EventArgs e)
        {
            if (this.WindowState == WindowState.Minimized)
                this.WindowState = WindowState.Normal;
            this.Activate();
        }

        private void ni_Click(object Sender, EventArgs e)
        {

        }

        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            control.Logout();
        }

        private void tbLogin_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)
        {
            if (e.Key.CompareTo(Key.Enter) == 0)
                this.pbPasswd.Focus();
        }

        private void pbPasswd_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)
        {
            if (e.Key.CompareTo(Key.Enter) == 0)
            {
                control.Login(tbLogin.Text, pbPasswd.Password);
            }
        }

        private void btnFindLocation_Click(object sender, RoutedEventArgs e)
        {
            control.FindLocation();
        }

        private void dataGridWarehouseman_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            control.Test("");
            
        }

        private void dataGridDocTable_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            
        }
    





    }
}
